<?php
/**
 * 广告位模板
 * User: crstu
 * Date: 2015/6/15
 * Time: 10:22
 */

use yii\helpers\Html;
use kartik\grid\GridView;


$this->title = '广告位管理';

$gridColumns = [
    ['class' => 'yii\grid\SerialColumn'],
    'name',
    'title',
    'remark',
    'createTime:datetime',
    [
        'attribute' => 'status',
        'value' => function($model){
            return $model->status ? "可用" : "不可用";
        }
    ],
    [
        'class' => 'common\widgets\KartikActionColumn',
        'items' => [
            ['修改', 'ad-position/edit', 'btn-primary'],
        ]
    ],

];

echo GridView::widget([
    'dataProvider' => $dataProvider,
    'panel' => [
        'type' => GridView::TYPE_DEFAULT,
        'heading' => '广告位列表',
    ],
    'toolbar' => [
        ['content' => Html::a('<i class="glyphicon glyphicon-plus"></i> 添加广告位', ['ad-position/add'], ['class' => 'btn btn-primary'])],        '{toggleData}'
    ],
    'columns' => $gridColumns,
]);

